﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;

namespace Common.Win32
{
    public static class MarshalEx
    {
        public static void ThrowLastWin32Error()
        {
            Int32 error = Marshal.GetLastWin32Error();
            if (0 != error)
            {
                Int32 hr = Marshal.GetHRForLastWin32Error();
                if (0 > hr) Marshal.ThrowExceptionForHR(error);
                throw new Win32Exception(error);
            }
        }
    }
}
